//
//  memoWidget.swift
//  memoWidget
//
//  Created by DaleGuo on 2023/10/8.
//

import SwiftUI
import WidgetKit




struct MemoWidget: Widget {
    
    let kind: String = "memoWidget"

    
    var body: some WidgetConfiguration {
        
        StaticConfiguration(kind: kind, provider: Provider()) { entry in
            if #available(iOS 17.0, *) {
                WidgetView(entry: entry)
                    .containerBackground(.fill.tertiary, for: .widget)
                    
                
            } else {
                WidgetView(entry: entry)
                    .padding()
                    .background()
            }
        }
        .configurationDisplayName("My Memo")
        .description("This is the memo widget to build your efficiency")
        .supportedFamilies([.systemMedium, .systemLarge])
        
        
    }
}

#Preview(as: .systemLarge) {
    MemoWidget()
} timeline: {
    MemoEntry(date: Date(), memo: MemoEntity(title: "a", content: "s", updated_time: Date()))
}
